<?php

namespace app\admins\controller;

use think\Controller;
use Util\SysDb;

class Baoming extends Controller
{
    public function insert()
    {
        //echo md5('123456');
        $realName = trim(input('param.realName'));
        $userNumber = input('param.userNumber');
        $userSex = input('param.userSex');
        $userPhone = trim(input('param.userPhone'));
        $userBirthday = input('param.userBirthday');
        $userEmail = input('param.userEmail');
        $myself = input('param.myself');
        $classname = input('param.classname');
        $Teacher = input('param.Teacher');
        $CourseCode = input('param.CourseCode');
        $grade=input('param.grade');
        $data['realName'] = $realName;
        $data['userNumber'] = $userNumber;
        $data['userSex'] = $userSex;
        $data['userPhone'] = $userPhone;
        $data['userBirthday'] = $userBirthday;
        $data['userEmail'] = $userEmail;
        $data['CourseCode'] = $CourseCode;
        $data['myself'] = $myself;
        $data['releaseStatus'] = '1';
        $data['Did'] = 't2_1';
        $data['userHobby'] = $classname;
        $data['grade'] = $grade;
        $data['Teacher'] = $Teacher;
        // 用户注册
        $this->db = new SysDb();
        $count = $this->db->table('examinelist')->where(['Did' => 't2_1'])->count();
        $data['examineid'] = $count + 2;
        $data['id'] = $count + 2;
        $this->db->table('examinelist')->insert($data);
        exit(json_encode(['code' => 0, 'msg' => '报名成功']));
    }
}
